package com.chen.exception;

import com.lmax.disruptor.ExceptionHandler;
import lombok.extern.log4j.Log4j;

/**
 * @Author: chen
 * @Date: 2021/5/24 2:18 PM
 * @Version 1.0
 */
@Log4j
public class DisruptorHandlerException implements ExceptionHandler<Object> {

    /**
     * 处理过程之中事件触发的异常
     * @param throwable
     * @param sequence  Sequence标示着写入进度
     * @param event  当前的事件
     */
    @Override
    public void handleEventException(Throwable throwable, long sequence, Object event) {
        log.error("处理过程之中事件触发的异常:"+throwable.getMessage());
    }

    /**
     * 启动时的异常
     * @param throwable
     */
    @Override
    public void handleOnStartException(Throwable throwable) {
        log.error("启动时的异常"+throwable.getMessage());
    }

    /**
     * 关机的异常
     * @param throwable
     */
    @Override
    public void handleOnShutdownException(Throwable throwable) {
        log.error("关机的异常"+throwable.getMessage());
    }
}
